<?php
include '../../../wp-blog-header.php';
if(!empty($_POST['comment_id']))
{
  $comment_id = $_POST['comment_id'];
  $columns_comment['approved'] = '1';
   
  $api = new PodAPI();
  $params_comment = array('datatype' => 'comment', 'tbl_row_id' => $comment_id, 'columns' => $columns_comment);
  $api->save_pod_item($params_comment);
  echo '<img src="'.get_bloginfo('wpurl').'/wp-content/pfiles/images/success.gif" />&nbsp;The Comment has been Approved!';
}
elseif(!empty($_POST['ids']))
{
  $ids = explode(',',$_POST['ids']);
  $comment_id = $ids['0'];
  $user_id = $ids['1'];
  
  $api = new PodAPI();
  $drop_params = array('tbl_row_id' => $comment_id, 'datatype' => 'comment');
  $api->drop_pod_item($drop_params);
  
  $points = new Pod('points');
  $points->findRecords('id DESC', "1", "user.id = '$user_id'");
  while($points->fetchRecord())
  {
    $points_id = $points->get_field('id');
    $points_comments = $points->get_field('comments');
  }
  
  $points_comments = ($points_comments - 50);
  $columns_points['comments'] = $points_comments;
  $params_points = array('datatype' => 'points', 'tbl_row_id' => $points_id, 'columns' => $columns_points);
  $api->save_pod_item($params_points);
  echo '<img src="'.get_bloginfo('wpurl').'/wp-content/pfiles/images/success.gif" />&nbsp;The Comment has been Deleted & 50 Points were deducted from the User!'; 
}
?>